package com.seal.commons.validator.jsr303;

import com.seal.commons.utils.BankCardNumberUtils;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import org.apache.commons.lang3.StringUtils;

public class BankCardNumValidator implements ConstraintValidator<BankCardNum, String> {

	@Override
	public void initialize(BankCardNum value) {
	}

	@Override
	public boolean isValid(String value, ConstraintValidatorContext arg1) {
	    if(StringUtils.isBlank(value)){
            return true;
        }
		return BankCardNumberUtils.isBankCardNumber(value);
	}

}
